package emap;

import java.util.ArrayList;
import java.awt.Graphics2D;
import java.awt.Image;

public class ViewportManager 
{
	private ArrayList<Viewport> viewList;
	public ViewportManager()
	{
		viewList=new ArrayList<Viewport>();
	}
	public void addView(Viewport toAdd)
	{
		viewList.add(toAdd);
	}
	public Viewport getView(int num)
	{
		if(num<0 || num>viewList.size()) 
			return null;
		return viewList.get(num);
	}
	public void setDrawTo(Graphics2D toDrawTo) //Call this before using drawing funcs!
	{ 
		for(int a=0;a<viewList.size();a++)
		{
			viewList.get(a).setDrawTo(toDrawTo);
			//this allows the viewports to draw themselves. Sends them a copy of the
			//Graphics2d, then they can add stuff on themselves. Awesome!
		}
	}
	public void drawImage(Image img,int locX,int locY)
	{
		for(int a=0;a<viewList.size();a++)
		{
			viewList.get(a).drawImage(img,locX,locY);
		}
	}
	public int getNumViews()
	{
		return viewList.size();
	}
	//TODO: add more drawing functions in the form 
	/*
	public void (drawname)(drawargs,int locX,int locY){
		for(int a=0;a<viewList.size();a++){
			viewList.get(a).(drawname)(drawargs,locX,locY);
			}
			}
	*/
	//And remember to add these to the Viewport class too.
	
	//they call me                  ANDREW
	//                     RPG coder extraordinaire
	//and they call me (Langston)  LANGSTON
	//                     RPG coder superordinaire
}